package example3;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DynamicProxy implements InvocationHandler {
	private Object sub;

	public DynamicProxy() {
	}

	public DynamicProxy(Object obj) {
		sub = obj;
	}

	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		//1 方法调用前处理逻辑
		System.out.println("before you do thing");
		//2 方法调用
		method.invoke(sub, args);
		//3 方法调用后处理逻辑
		System.out.println("after you do thing");
		return null;
	}
}
